home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / liveconnect / nsILiveconnect.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  196 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is Mozilla Communicator client code, released
  17.  * March 31, 1998.
  18.  *
  19.  * The Initial Developer of the Original Code is
  20.  * Netscape Communications Corporation.
  21.  * Portions created by the Initial Developer are Copyright (C) 1998
  22.  * the Initial Developer. All Rights Reserved.
  23.  *
  24.  * Contributor(s):
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  28.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39. /*
  40.  * This file is part of the Java-vendor-neutral implementation of LiveConnect
  41.  *
  42.  * It contains the public XP-COM based interface for java to javascript communication.
  43.  *
  44.  */
  45.  
  46. #ifndef nsILiveconnect_h___
  47. #define nsILiveconnect_h___
  48.  
  49. #include "nsISupports.h"
  50. #include "nsIFactory.h"
  51. #include "jni.h"
  52. #include "jsjava.h" // For lcjsobject
  53.  
  54. #define NS_ILIVECONNECT_IID                          \
  55. { /* 68190910-3318-11d2-97f0-00805f8a28d0 */         \
  56.     0x68190910,                                      \
  57.     0x3318,                                          \
  58.     0x11d2,                                          \
  59.     {0x97, 0xf0, 0x00, 0x80, 0x5f, 0x8a, 0x28, 0xd0} \
  60. }
  61.  
  62. #define NS_CLIVECONNECT_CID                          \
  63. { /* b8f0cef0-3931-11d2-97f0-00805f8a28d0 */         \
  64.     0xb8f0cef0,                                      \
  65.     0x3931,                                          \
  66.     0x11d2,                                          \
  67.     {0x97, 0xf0, 0x00, 0x80, 0x5f, 0x8a, 0x28, 0xd0} \
  68. }
  69.  
  70. class nsILiveconnect : public nsISupports {
  71. public:
  72.     NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILIVECONNECT_IID)
  73.     NS_DEFINE_STATIC_CID_ACCESSOR(NS_CLIVECONNECT_CID)
  74.     
  75.     /**
  76.      * get member of a Native JSObject for a given name.
  77.      *
  78.      * @param obj        - A Native JS Object.
  79.      * @param name       - Name of a member.
  80.      * @param pjobj      - return parameter as a java object representing 
  81.      *                     the member. If it is a basic data type it is converted to
  82.      *                     a corresponding java type. If it is a NJSObject, then it is
  83.      *                     wrapped up as java wrapper netscape.javascript.JSObject.
  84.      */
  85.     NS_IMETHOD
  86.     GetMember(JNIEnv *jEnv, lcjsobject jsobj, const jchar *name, jsize length, void* principalsArray[], 
  87.               int numPrincipals, nsISupports *securitySupports, jobject *pjobj) = 0;
  88.  
  89.     /**
  90.      * get member of a Native JSObject for a given index.
  91.      *
  92.      * @param obj        - A Native JS Object.
  93.      * @param slot      - Index of a member.
  94.      * @param pjobj      - return parameter as a java object representing 
  95.      *                     the member. 
  96.      */
  97.     NS_IMETHOD
  98.     GetSlot(JNIEnv *jEnv, lcjsobject jsobj, jint slot, void* principalsArray[], 
  99.             int numPrincipals, nsISupports *securitySupports, jobject *pjobj) = 0;
  100.  
  101.     /**
  102.      * set member of a Native JSObject for a given name.
  103.      *
  104.      * @param obj        - A Native JS Object.
  105.      * @param name       - Name of a member.
  106.      * @param jobj       - Value to set. If this is a basic data type, it is converted
  107.      *                     using standard JNI calls but if it is a wrapper to a JSObject
  108.      *                     then a internal mapping is consulted to convert to a NJSObject.
  109.      */
  110.     NS_IMETHOD
  111.     SetMember(JNIEnv *jEnv, lcjsobject jsobj, const jchar* name, jsize length, jobject jobj, void* principalsArray[], 
  112.               int numPrincipals, nsISupports *securitySupports) = 0;
  113.  
  114.     /**
  115.      * set member of a Native JSObject for a given index.
  116.      *
  117.      * @param obj        - A Native JS Object.
  118.      * @param index      - Index of a member.
  119.      * @param jobj       - Value to set. If this is a basic data type, it is converted
  120.      *                     using standard JNI calls but if it is a wrapper to a JSObject
  121.      *                     then a internal mapping is consulted to convert to a NJSObject.
  122.      */
  123.     NS_IMETHOD
  124.     SetSlot(JNIEnv *jEnv, lcjsobject jsobj, jint slot, jobject jobj, void* principalsArray[], 
  125.             int numPrincipals, nsISupports *securitySupports) = 0;
  126.  
  127.     /**
  128.      * remove member of a Native JSObject for a given name.
  129.      *
  130.      * @param obj        - A Native JS Object.
  131.      * @param name       - Name of a member.
  132.      */
  133.     NS_IMETHOD
  134.     RemoveMember(JNIEnv *jEnv, lcjsobject jsobj, const jchar* name, jsize length,  void* principalsArray[], 
  135.                  int numPrincipals, nsISupports *securitySupports) = 0;
  136.  
  137.     /**
  138.      * call a method of Native JSObject. 
  139.      *
  140.      * @param obj        - A Native JS Object.
  141.      * @param name       - Name of a method.
  142.      * @param jobjArr    - Array of jobjects representing parameters of method being caled.
  143.      * @param pjobj      - return value.
  144.      */
  145.     NS_IMETHOD
  146.     Call(JNIEnv *jEnv, lcjsobject jsobj, const jchar* name, jsize length, jobjectArray jobjArr,  void* principalsArray[], 
  147.          int numPrincipals, nsISupports *securitySupports, jobject *pjobj) = 0;
  148.  
  149.     /**
  150.      * Evaluate a script with a Native JS Object representing scope.
  151.      *
  152.      * @param obj                - A Native JS Object.
  153.      * @param principalsArray    - Array of principals to be used to compare privileges.
  154.      * @param numPrincipals      - Number of principals being passed.
  155.      * @param script             - Script to be executed.
  156.      * @param pjobj              - return value.
  157.      */
  158.     NS_IMETHOD    
  159.     Eval(JNIEnv *jEnv, lcjsobject obj, const jchar *script, jsize length, void* principalsArray[], 
  160.          int numPrincipals, nsISupports *securitySupports, jobject *pjobj) = 0;
  161.  
  162.     /**
  163.      * Get the window object for a plugin instance.
  164.      *
  165.      * @param pJavaObject        - Either a jobject or a pointer to a plugin instance 
  166.      *                             representing the java object.
  167.      * @param pjobj              - return value. This is a native js object 
  168.      *                             representing the window object of a frame 
  169.      *                             in which a applet/bean resides.
  170.      */
  171.     NS_IMETHOD
  172.     GetWindow(JNIEnv *jEnv, void *pJavaObject, void* principalsArray[], 
  173.               int numPrincipals, nsISupports *securitySupports, lcjsobject *pobj) = 0;
  174.  
  175.     /**
  176.      * Get the window object for a plugin instance.
  177.      *
  178.      * @param jEnv       - JNIEnv on which the call is being made.
  179.      * @param obj        - A Native JS Object.
  180.      */
  181.     NS_IMETHOD
  182.     FinalizeJSObject(JNIEnv *jEnv, lcjsobject jsobj) = 0;
  183.  
  184.     /**
  185.      * Get the window object for a plugin instance.
  186.      *
  187.      * @param jEnv       - JNIEnv on which the call is being made.
  188.      * @param obj        - A Native JS Object.
  189.      * @param jstring    - Return value as a jstring representing a JS object.
  190.      */
  191.     NS_IMETHOD
  192.     ToString(JNIEnv *jEnv, lcjsobject obj, jstring *pjstring) = 0;
  193. };
  194.  
  195. #endif // nsILiveconnect_h___
  196.